home *** CD-ROM | disk | FTP | other *** search
/ PC-Blue - MS DOS Public Domain Library / PC-Blue MS-DOS Public Domain Library - NYACC.iso / vol350 / prolog.arc / SAMPLES.ARC / FOR.PRO < prev    next >
Encoding:
Text File  |  1987-05-30  |  256 b   |  7 lines

  1. /* This is a test of using a FOR loop in prolog */
  2.  
  3. for(X, [X, Z]) :- X =< Z.
  4. for(X, [Y, Z]) :- W is Y + 1, W =< Z, for(X, [W, Z]).
  5.  
  6. ?-nl, for(X, [1, 10]), print(X, ' '), X = 10.
  7.